import 'package:flutter/material.dart';

//封装传递的参数
class ScreenArguments {
  final String title;
  final String message;

  ScreenArguments(this.title, this.message);
}


class EchoRoute extends StatelessWidget {
  static const routeName = '/echoArguments';

  @override
  Widget build(BuildContext context) {
    //获取路由参数
    final args = ModalRoute.of(context)!.settings.arguments as ScreenArguments;
    //...省略无关代码
    return Scaffold(
      appBar: AppBar(
        title: Text(args.title),
      ),
      body: Center(
        child: Text(args.message),
      ),
    );
  }
}
